#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<vector>
#include<cmath>
using namespace std;
class Solution {
public:
    vector<vector<int>> generate(int numRows) {
        vector<vector<int>> r;
        for (int k = 1; k <= numRows; k++) {
            r.push_back(vector<int>(k));
        }
        for (int i = 0; i < numRows; i++) {
            r[i][0] = 1;
            r[i][i] = 1;
            if (i > 1) {
                for (int j = 1; j < i; j++) {
                    r[i][j] = r[i - 1][j - 1] + r[i - 1][j];
                }
            }
        }
        return r;
    }

    int removeDuplicates(vector<int>& nums) {
        for (int i = 0; i+1 < nums.size(); i++) {
            if (nums[i] == nums[i + 1]) {
                nums.erase(nums.begin()+i);
                i--;
            }
        }
        return nums.size();
    }

    vector<int> singleNumber1(vector<int>& nums) {
        vector<int> cop = nums;
        for (int i = 0; i < cop.size(); i++) {
            for (int j = 0; j < cop.size(); j++) {
                if (i == -1)
                    break;
                if (cop[i] == cop[j] && i != j) {
                    cop.erase(cop.begin() + i);
                    i--;
                    j--;
                    cop.erase(cop.begin() + j);
                    j--;
                }
            }
        }
        return cop;
    }
    int singleNumber(vector<int>& nums) {
        vector<int> a;
        a.resize(nums.size());
        for (int i = 0; i < nums.size(); i++) {
            for (int j = 0; j < nums.size(); j++) {
                if (nums[i] == nums[j]) {
                    a[i]++;
                }
            }
            if (a[i] == 1)
                return nums[i];
        }
    }
};
int main() {
    //int a;
    //cin >> a;
    Solution s;
    //vector<vector<int>> b(s.generate(a));
    //for (int i = 0; i < a; i++) {
    //    for (int j = 0; j < a; j++) {
    //        cout << b[i][j];
    //    }
    //    cout << endl;
    //}

    /*vector<int> v{ 0, 0, 1, 1, 1, 2, 2, 3, 3, 4 };
    int i = s.removeDuplicates(v);*/

    /*vector<int> b = { 1403617094,-490450406,-1756388866,-967931676,1878401007,1878401007,-74743538,1403617094,-1756388866,-74743538,-490450406,-1895772685 };
    vector<int> c = s.singleNumber(b);
    for (int i = 0; i < c.size(); i++) {
        cout << c[i] << " ";
    }*/
    vector<int> b{ 0,1,0,1,0,1,99 };
    cout<<s.singleNumber(b);
}
